package com.john.springbootpseudostatic;

import com.john.springbootpseudostatic.interceptor.HtmlInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * SpringBoot实现伪静态化方案二：通过自定义拦截器将*.html后缀的请求转发到对应的不带.html后缀的地址
 */
@Configuration
public class MyWebMVCConfiguration2 implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new HtmlInterceptor()).addPathPatterns("/**");
    }

}
